using UnityEngine;

public class ReliveUI : MonoBehaviour
{
	private GameObject optionobj;

	public UIEventListener yesbtn;

	public UIEventListener nobtn;

	private bool isshow;

	public UILabel ownlabel;

	public UIWidget hintwi;

	private void Start()
	{
		yesbtn.onClick = OnClickyesBtn;
		nobtn.onClick = OnClicknoBtn;
	}

	public void OnClickyesBtn(GameObject btn)
	{
		if (GamePlayerprefs.instance.DecDiamond(5))
		{
			plane_smothfollow.instance.Reset_posrot();
			disable();
			Platform.HideFeatureView();
			Platform.flurryEvent_level(GlobalInf.CurrentLevel, 10);
		}
		else
		{
			hintwi.alpha = 1f; hintwi.gameObject.SetActive(true);
		}
	}

	public void enable()
	{
		if (optionobj == null)
		{
			optionobj = base.gameObject;
		}
		NGUITools.SetActive(optionobj, state: true);
		isshow = true;
		Time.timeScale = 0f;
		ownlabel.text = "你拥有 " + GamePlayerprefs.instance.alldiamond;
		hintwi.alpha = 0f; hintwi.gameObject.SetActive(false);
		Platform.ShowFeatureView();
	}

	public void OnClicknoBtn(GameObject btn)
	{
		if (isshow)
		{
			isshow = false;
			MonoInstance<AudioController>.instance.play(AudioType.UI_BTN, 0f);
			TasksController.instance.gameover_relive();
			plane_smothfollow.instance.target = null;
			disable();
		}
	}

	public void disable()
	{
		if (optionobj == null)
		{
			optionobj = base.gameObject;
		}
		NGUITools.SetActive(optionobj, state: false);
		gamebackctl.instance.BackGameUIstate();
		Time.timeScale = 1f;
	}
}
